package com.vhall.component.service.export.assembler;

import com.vhall.component.entity.export.ExportEntity;
import com.vhall.component.entity.export.vo.ExportAdmRspVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * 导出类实体对象间转换
 *
 * @author yuanzh
 * @date 2021/11/19
 */
@Mapper(componentModel = "spring")
public interface ExportAssembler {

    /**
     * 导出实体对象转换为响应对象
     *
     * @param entity 导出实体对象
     * @return 响应对象
     */
    @Mapping(source = "ext", target = "fileExt")
    @Mapping(source = "ossFile", target = "fileUrl")
    @Mapping(source = "createdAt", target = "createdAt", dateFormat = "yyyy-MM-dd HH:mm:ss")
    ExportAdmRspVO toRspVo(ExportEntity entity);

    /**
     * admin导出列表转换为响应列表
     *
     * @param entities 导出列表
     * @return 响应列表
     */
    List<ExportAdmRspVO> toRspVos(List<ExportEntity> entities);

}
